#include <iostream>
#include <cstring>
using namespace std;

// 设备类
class EquipmentClass
{
public:
    int equipment_id; // 设备ID
    char equipment_name[20]; // 设备名称

};

// 触摸屏类 - 使用protected继承
class TouchClass : protected EquipmentClass
{
public:
    // 构造函数
    TouchClass()
    {
        touch_screen_size = 0;
    }
    
    // 带参数的构造函数
    TouchClass(int id, const char* name, int size)
    {
        // 通过基类的公有成员直接访问
        equipment_id = id;
        strcpy(equipment_name, name);
        touch_screen_size = size;
    }
    
    // 析构函数
    ~TouchClass()
    {
        cout << "TouchClass destroyed" << endl;
    }
    
    // 设置触摸屏尺寸
    void setTouchScreenSize(int size)
    {
        touch_screen_size = size;
    }
    
    // 获取触摸屏尺寸
    int getTouchScreenSize() const
    {
        return touch_screen_size;
    }
    
    // 设置设备ID（通过派生类提供公共接口访问基类protected成员）
    void setEquipmentId(int id)
    {
        equipment_id = id;
    }
    
    // 获取设备ID
    int getEquipmentId() const
    {
        return equipment_id;
    }
    
    // 设置设备名称
    void setEquipmentName(const char* name)
    {
        strcpy(equipment_name, name);
    }
    
    // 获取设备名称
    const char* getEquipmentName() const
    {
        return equipment_name;
    }
    
    // 显示触摸屏信息
    void displayInfo() const
    {
        cout << "==== 触摸屏信息 ====" << endl;
        cout << "设备ID: " << equipment_id << endl;
        cout << "设备名称: " << equipment_name << endl;
        cout << "触摸屏尺寸: " << touch_screen_size << " 英寸" << endl;
    }
    
public:
    int touch_screen_size; // 触摸屏尺寸
};

// LCD类 - 使用protected继承
class LCDClass : protected EquipmentClass
{
public:
    // 构造函数
    LCDClass()
    {
        lcd_size = 0;
    }
    
    // 带参数的构造函数
    LCDClass(int id, const char* name, int size)
    {
        equipment_id = id;
        strcpy(equipment_name, name);
        lcd_size = size;
    }
    
    // 析构函数
    ~LCDClass()
    {
        cout << "LCDClass destroyed" << endl;
    }
    
    // 设置LCD尺寸
    void setLCDSize(int size)
    {
        lcd_size = size;
    }
    
    // 获取LCD尺寸
    int getLCDSize() const
    {
        return lcd_size;
    }
    
    // 设置设备ID
    void setEquipmentId(int id)
    {
        equipment_id = id;
    }
    
    // 获取设备ID
    int getEquipmentId() const
    {
        return equipment_id;
    }
    
    // 设置设备名称
    void setEquipmentName(const char* name)
    {
        strcpy(equipment_name, name);
        equipment_name[19] = '\0'; // 确保不会越界
    }
    
    // 获取设备名称
    const char* getEquipmentName() const
    {
        return equipment_name;
    }
    
    // 显示LCD信息
    void displayInfo() const
    {
        cout << "==== LCD信息 ====" << endl;
        cout << "设备ID: " << equipment_id << endl;
        cout << "设备名称: " << equipment_name << endl;
        cout << "LCD尺寸: " << lcd_size << " 英寸" << endl;
    }
    
public:
    int lcd_size; // LCD尺寸
};

// 主函数用于测试
int main()
{
    // 测试基类
    cout << "=== 测试基类EquipmentClass ===" << endl;
    
    // 测试触摸屏类
    cout << "\n=== 测试派生类TouchClass ===" << endl;
    TouchClass touch(2001, "电容触摸屏", 10.1);
    touch.displayInfo();
    
    // 测试LCD类
    cout << "\n=== 测试派生类LCDClass ===" << endl;
    LCDClass lcd(3001, "高清显示屏", 15.6);
    lcd.displayInfo();
    
    // 测试修改属性
    cout << "\n=== 测试修改属性 ===" << endl;
    touch.setTouchScreenSize(12.3);
    touch.setEquipmentName("多点触摸屏");
    touch.displayInfo();
    
    return 0;
}